﻿/*
COPYRIGHT (C) 2011-2012 Raynald Messié

THIS FILE IS PART OF SCRUMPILOT.

SCRUMPILOT IS FREE SOFTWARE: YOU CAN REDISTRIBUTE IT AND/OR MODIFY IT UNDER THE TERMS OF 
THE GNU LESSER GENERAL PUBLIC LICENSE VERSION v2.1 AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION.

SCRUMPILOT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT WITHOUT ANY WARRANTY; WITHOUT
EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU LESSER
GENERAL PUBLIC LICENSE FOR MORE DETAILS.

YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE ALONG WITH SCRUMPILOT. 
IF NOT, SEE <HTTP://WWW.GNU.ORG/LICENSES/>.
*/

using System;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Xml.Serialization;

namespace ScrumPilot.Helpers
{
    /// <summary>
    /// Event raised when a change occurs to a Work Item
    /// </summary>
    [GeneratedCode("xsd", "2.0.50727.42")]
    [Serializable]
    [DebuggerStepThrough]
    [DesignerCategory("code")]
    [XmlType(AnonymousType = true)]
    [XmlRoot(Namespace = "", IsNullable = false)]
    // ReSharper disable PartialTypeWithSinglePart
    public partial class WorkItemChangedEvent
    // ReSharper restore PartialTypeWithSinglePart
    {
        #region Public Properties

        /// <remarks/>
        public string PortfolioProject { get; set; }

        /// <remarks/>
        public string ProjectNodeId { get; set; }

        /// <remarks/>
        public string AreaPath { get; set; }

        /// <remarks/>
        public string Title { get; set; }

        /// <remarks/>
        public string WorkItemTitle { get; set; }

        /// <remarks/>
        public string Subscriber { get; set; }

        /// <remarks/>
        public string ChangerSid { get; set; }

        /// <remarks/>
        public string DisplayUrl { get; set; }

        /// <remarks/>
        public string TimeZone { get; set; }

        /// <remarks/>
        public string TimeZoneOffset { get; set; }

        /// <remarks/>
        public ChangeTypes ChangeType { get; set; }

        /// <remarks/>
        public CoreFieldsType CoreFields { get; set; }

        /// <remarks/>
        [XmlArrayItem("Field", IsNullable = false)]
        public TextField[] TextFields { get; set; }

        /// <remarks/>
        public ChangedFieldsType ChangedFields { get; set; }

        /// <remarks/>
        [XmlArrayItem("Name", IsNullable = false)]
        public string[] AddedFiles { get; set; }

        /// <remarks/>
        [XmlArrayItem("FileId", IsNullable = false)]
        public string[] DeletedFiles { get; set; }

        /// <remarks/>
        [XmlArrayItem("Resource", IsNullable = false)]
        public string[] AddedResourceLinks { get; set; }

        /// <remarks/>
        [XmlArrayItem("LinkId", IsNullable = false)]
        public string[] DeletedResourceLinks { get; set; }

        /// <remarks/>
        [XmlArrayItem("LinkId", IsNullable = false)]
        public string[] ChangedResourceLinks { get; set; }

        /// <remarks/>
        [XmlArrayItem("WorkItemId", IsNullable = false)]
        public string[] AddedRelations { get; set; }

        /// <remarks/>
        [XmlArrayItem("WorkItemId", IsNullable = false)]
        public string[] DeletedRelations { get; set; }

        /// <remarks/>
        [XmlArrayItem("WorkItemId", IsNullable = false)]
        public string[] ChangedRelations { get; set; }

        #endregion
    }

    /// <summary>
    /// Enumeration which lists the type of change that has occured
    /// </summary>
    [GeneratedCode("xsd", "2.0.50727.42")]
    [Serializable]
    [XmlType(Namespace = "")]
    public enum ChangeTypes
    {
        /// <summary>
        /// The Work Item has been created
        /// </summary>
        New,

        /// <summary>
        /// The Work Item has been changed
        /// </summary>
        Change
    }

    /// <summary>
    /// Type which contains the CoreFields of the Work Item
    /// </summary>
    [GeneratedCode("xsd", "2.0.50727.42")]
    [Serializable]
    [DebuggerStepThrough]
    [DesignerCategory("code")]
    [XmlType(Namespace = "")]
    // ReSharper disable PartialTypeWithSinglePart
    public partial class CoreFieldsType
    // ReSharper restore PartialTypeWithSinglePart
    {
        #region Public Properties

        /// <remarks/>
        [XmlArrayItem("Field", IsNullable = false)]
        public List<IntegerField> IntegerFields { get; set; }

        /// <remarks/>
        [XmlArrayItem("Field", IsNullable = false)]
        public List<StringField> StringFields { get; set; }

        #endregion
    }

    /// <summary>
    /// Type which contains the old and new values of the interger field that has changed
    /// </summary>
    [GeneratedCode("xsd", "2.0.50727.42")]
    [Serializable]
    [DebuggerStepThrough]
    [DesignerCategory("code")]
    [XmlType(Namespace = "")]
    // ReSharper disable PartialTypeWithSinglePart
    public partial class IntegerField
    // ReSharper restore PartialTypeWithSinglePart
    {
        #region Public Properties

        /// <remarks/>
        public string Name { get; set; }

        /// <remarks/>
        public string ReferenceName { get; set; }

        /// <remarks/>
        public int OldValue { get; set; }

        /// <remarks/>
        public int NewValue { get; set; }

        #endregion
    }

    /// <summary>
    /// Type which contains a list of the fields that have changed
    /// </summary>
    [GeneratedCode("xsd", "2.0.50727.42")]
    [Serializable]
    [DebuggerStepThrough]
    [DesignerCategory("code")]
    [XmlType(Namespace = "")]
    // ReSharper disable PartialTypeWithSinglePart
    public partial class ChangedFieldsType
    // ReSharper restore PartialTypeWithSinglePart
    {
        #region Public Properties

        /// <remarks/>
        [XmlArrayItem("Field", IsNullable = false)]
        public List<IntegerField> IntegerFields { get; set; }

        /// <remarks/>
        [XmlArrayItem("Field", IsNullable = false)]
        public List<StringField> StringFields { get; set; }

        #endregion
    }

    /// <summary>
    /// Type which contains the old and new values of the string field that has changed
    /// </summary>
    [GeneratedCode("xsd", "2.0.50727.42")]
    [Serializable]
    [DebuggerStepThrough]
    [DesignerCategory("code")]
    [XmlType(Namespace = "")]
    // ReSharper disable PartialTypeWithSinglePart
    public partial class StringField
    // ReSharper restore PartialTypeWithSinglePart
    {
        #region Public Properties

        /// <remarks/>
        public string Name { get; set; }

        /// <remarks/>
        public string ReferenceName { get; set; }

        /// <remarks/>
        public string OldValue { get; set; }

        /// <remarks/>
        public string NewValue { get; set; }

        #endregion
    }

    /// <summary>
    /// Type which contains information about the Work Item's text field
    /// </summary>
    [GeneratedCode("xsd", "2.0.50727.42")]
    [Serializable]
    [DebuggerStepThrough]
    [DesignerCategory("code")]
    [XmlType(Namespace = "")]
    // ReSharper disable PartialTypeWithSinglePart
    public partial class TextField
    // ReSharper restore PartialTypeWithSinglePart
    {
        #region Public Properties

        /// <remarks/>
        public string Name { get; set; }

        /// <remarks/>
        public string ReferenceName { get; set; }

        /// <remarks/>
        public string Value { get; set; }

        #endregion
    }
}